package com.xc.controller;

import com.xc.model.entity.CompanyEntity;
import com.xc.model.entity.NavEntity;
import com.xc.model.entity.UserEntity;
import com.xc.model.vo.UserVO;
import com.xc.service.CompanyService;
import com.xc.service.HomeService;
import com.xc.service.impl.HomeServiceImpl;
import com.xc.utils.JSONCopy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/home")
public class HomeController {

    //    @Autowired
//    private HomeService homeService;
    @Autowired
    private CompanyService companyService;
//    @Autowired
//    private NavService navService;

    @GetMapping("/company")
    public Object getCompanyModel(UserVO userVO) {
//        System.out.println(userVO);
//        CompanyEntity companyEntity = new CompanyEntity();
//        companyEntity.setLogo("../img/logo_g0yv.jpg");
//        companyEntity.setPhone("028-999999999");
//        return companyEntity;
//        HomeService homeService = new HomeServiceImpl();
//        UserEntity entity=new UserEntity();
//        entity.setUsername(userVO.getUsername());
//        entity.setPassword(userVO.getPassword());
        return companyService.getCompanyModel(JSONCopy.copy(userVO, UserEntity.class));
    }

    @GetMapping("/nav")
    public Object getNavArray() {
        NavEntity[] navEntities = new NavEntity[6];
        NavEntity entity = new NavEntity();
        entity.setName("网站首页");
        navEntities[0] = entity;
        NavEntity entity1 = new NavEntity();
        entity1.setName("网站首页");
        navEntities[1] = entity1;

        return navEntities;
    }
}
